from django.db.models.sql.query import RawQuery
from django.db.models.query import RawQuerySet
from books.models import *


def run():
    sql = f'SELECT * FROM books WHERE id > %s'
    params = (0, )
    # raw_query = RawQuery(sql=sql, using='default', params=params)
    raw_queryset = RawQuerySet(sql, model=Books, using='default', params=params)
    print(len(raw_queryset))
    # query = iter(raw_queryset.query)
    for q in raw_queryset.query:
        print(q)

